//
//  NSString+Common.h
//  Coffee
//
//  Created by 周天雨 on 2017/8/17.
//  Copyright © 2017年 周天雨. All rights reserved.
//
#include <sys/socket.h>
#include <sys/sysctl.h>
@interface NSString (Common)

///计算文本高度
- (CGFloat)getLabSizeWithFont:(CGFloat )font AndSize:(CGFloat)sizeWidth;
///计算文本Size
- (CGSize)gettextSizeWithFont:(CGFloat)font AndSize:(CGFloat)sizeWidth;
///对字符串中含有表情处理
+ (BOOL)stringContainsEmoji:(NSString *)string;
///将时间转化成
+ (NSString *)getTimeStringFromString:(NSString *)time;
+ (NSString *)getTime:(NSString *)time;
+ (NSString *)getTimeString:(NSInteger)day;
+ (NSString *)getstringTime:(NSString *)string;
+ (NSString*)getdayString:(NSString *)string;
+ (NSString *)getYYMMDD:(NSDate *)date;
+ (NSString *)getstringtimeString:(NSString *)string;
+ (NSString *)getCurrentTimeString;
+ (BOOL)isBlankString:(NSString *)string;
+ (NSString *)escapedString: (NSString *)str;
+ (NSString *)timeFormattedFromeTimeInterval:(NSInteger)time;
///分钟数处理
+ (NSString *)minutesTurnHour:(NSString *)minutes;
///粉丝数处理
+ (NSString *)distanceString:(NSString *)string;
+ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;
+ (NSInteger)chineseCountOfString:(NSString *)string;
+ (NSString *)captureCharacter:(NSString *)string count:(NSInteger)count;
///把手机号第4-7位变成星号
+(NSString *)phoneNumToAsterisk:(NSString*)phoneNum;
///把身份证生日部分位变成星号
+ (NSString *)replaceStringWithAsterisk:(NSString *)idCard withStartLoca:(NSInteger)startLocation length:(NSInteger)length;
///错误提示
+ (void)hudErrorMessage:(NSError *)error withViewController:(UIViewController *)vc;
///token解析
+ (id)jwtDecodeWithJwtString:(NSString *)jwtStr;
///根据URL生成二维码
+ (UIImage *)df_createQRcodeWithUrlstring:(NSString *)urlString witImageSize:(CGSize)size;
///根据内容生成二维码
+ (UIImage *)df_createQRcodeWithContent:(NSString *)title withIdCard:(NSString *)idCard withCardNum:(NSString *)cardNo withMobile:(NSString *)mobile witImageSize:(CGSize)size;
///身份证号码校验
- (BOOL)validateIdentityCard;
///密码强度判断:0弱 1一般 2强
+ (NSString*)judgePasswordStrength:(NSString*)password;
///判断字符串是否一个HttpURL
+ (BOOL)isHttpUrl:(NSString *)url;
//复制
+ (void)generalPasteboard:(NSString *)past withComplectionHandle:(void(^)(BOOL copyStatus))complectionHandle;
//手机设备判断
+ (NSString *)machineModelName;
///拨打电话
+ (void)callMobile:(NSString *)phone;
///通过URL打开浏览器
+ (void)applicationOpenUrl:(NSString *)params;
///检测URL是否能够ping通
+ (void)validateUrl:(NSString *)candidate callBack:(void(^)(BOOL))callback;
+ (BOOL)isEmpty:(NSString *)string;


+ (NSString *)convertStringWithTime:(float)time;

@end
